<html>
<head><meta charset="utf-8"><title>Construct span · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html">Construct span</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="237490833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237490833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hi-rustin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237490833">(May 05 2021 at 13:02)</a>:</h4>
<p>If I have a <code>str::trim_left </code>  span, how do I construct it as <code>trim_left</code>? Is there any way to get rid of the ns in front of it? Can someone help me? Thanks!</p>



<a name="237490990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237490990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237490990">(May 05 2021 at 13:03)</a>:</h4>
<p>I don't think there's a way to do this in general, the info isn't available in the span and you can't blindly advance it by 5 spaces because it's possible to have whitespace in between</p>



<a name="237491577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237491577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237491577">(May 05 2021 at 13:08)</a>:</h4>
<p>Where did you get the span from?</p>



<a name="237491707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237491707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hi-rustin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237491707">(May 05 2021 at 13:09)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/76a04dd3f8b2500d9e524dca122814fd5a3e25e4/compiler/rustc_middle/src/middle/stability.rs#L284">https://github.com/rust-lang/rust/blob/76a04dd3f8b2500d9e524dca122814fd5a3e25e4/compiler/rustc_middle/src/middle/stability.rs#L284</a></p>



<a name="237491971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237491971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237491971">(May 05 2021 at 13:10)</a>:</h4>
<p>Hm, that's the function I guess? If you want to reduce it to the last element of the path I'd try to figure out who calls that and see how they're computing the span</p>



<a name="237494914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237494914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hi-rustin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237494914">(May 05 2021 at 13:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Construct.20span/near/237491971">said</a>:</p>
<blockquote>
<p>Hm, that's the function I guess? If you want to reduce it to the last element of the path I'd try to figure out who calls that and see how they're computing the span</p>
</blockquote>
<p><del> It should be calculated in this place. <a href="https://github.com/rust-lang/rust/blob/2d11e257945c710d406e77903764ad4b7a52bda5/compiler/rustc_passes/src/stability.rs#L742">https://github.com/rust-lang/rust/blob/2d11e257945c710d406e77903764ad4b7a52bda5/compiler/rustc_passes/src/stability.rs#L742</a> </del></p>



<a name="237507822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237507822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hi-rustin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237507822">(May 05 2021 at 14:50)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Construct.20span/near/237491971">said</a>:</p>
<blockquote>
<p>Hm, that's the function I guess? If you want to reduce it to the last element of the path I'd try to figure out who calls that and see how they're computing the span</p>
</blockquote>
<p>It should be calculated in this place. <a href="https://github.com/rust-lang/rust/blob/24acc388da2cdbe1ec79b6933402941b6fffb26b/compiler/rustc_typeck/src/check/expr.rs#L469">https://github.com/rust-lang/rust/blob/24acc388da2cdbe1ec79b6933402941b6fffb26b/compiler/rustc_typeck/src/check/expr.rs#L469</a></p>



<a name="237510682"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Construct%20span/near/237510682" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hi-rustin <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Construct.20span.html#237510682">(May 05 2021 at 15:03)</a>:</h4>
<p>I may have found a solution, thanks for your replies.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>